function maxProfit(prices: number[]): number {
    const result: number[] =[]
    for(let i = 0; i < prices.length ; i++){
        if(prices.length<2){
            result.push(0)
        }
        for(let j = i+1; j < prices.length; j++){
            result.push(prices[j]-prices[i])
        }
    }
    // console.log(result);
    return Math.max(...result.map((item)=> item<0?0:item));
};

// 算法没看懂
// 暴力破解
 maxProfit([7])